﻿using System;
using System.Data;
using System.Configuration;
using System.Web;

using DatabaseService;
/// <summary>
/// Summary description for GoldenPrice_Factory
/// </summary>
/// 
namespace WorldExchange
{
    public class Exchange_Factory
    {
        public Price AUD;
        public Price CAD;
        public Price CHF;
        public Price DKK;
        public Price EUR;
        public Price GBP;
        public Price HKD;
        public Price INR;
        public Price JPY;
        public Price KRW;
        public Price KWD;
        public Price MYR;
        public Price NOK;
        public Price SEK;
        public Price SGD;
        public Price THB;
        public Price USD;
        public Exchange_Factory()
        {

        }

        public void getPrice(string className)
        {
            Object obj = Activator.CreateInstance(Type.GetType("WorldExchange." + className));
            Exchange GP = obj as Exchange;
            GP.getExchange();
            this.AUD = Exchange.UniqueInstance.AUD;
            this.CAD = Exchange.UniqueInstance.CAD;
            this.CHF = Exchange.UniqueInstance.CHF;
            this.DKK = Exchange.UniqueInstance.DKK;
            this.EUR = Exchange.UniqueInstance.EUR;
            this.GBP = Exchange.UniqueInstance.GBP;
            this.HKD = Exchange.UniqueInstance.HKD;
            this.INR = Exchange.UniqueInstance.INR;
            this.JPY = Exchange.UniqueInstance.JPY;
            this.KRW = Exchange.UniqueInstance.KRW;
            this.KWD = Exchange.UniqueInstance.KWD;
            this.MYR = Exchange.UniqueInstance.MYR;
            this.NOK = Exchange.UniqueInstance.NOK;
            this.SEK = Exchange.UniqueInstance.SEK;
            this.SGD = Exchange.UniqueInstance.SGD;
            this.THB = Exchange.UniqueInstance.THB;
            this.USD = Exchange.UniqueInstance.USD;
           
        }

        public bool writeToDB(string className)
        {
            this.getPrice(className);
          AccessDB.InsertExchangeDB(this, className);
          return true;
        }
    }
}